import request from '@/utils/request'

// 提交购物订单
export const submitOrder = (mode, obj, remark) => {
  return request.post('/checkout/submit', {
    mode,
    delivery: 10,
    couponId: 0,
    isUsePoints: 0,
    payType: 10,
    remark,
    ...obj
  })
}

// 获取订单详情
export const getOrderDetail = (mode, obj) => {
  return request.get('/checkout/order', {
    params: {
      mode,
      delivery: 10,
      couponId: 0,
      isUsePoints: 0,
      ...obj
    }
  })
}

// 获取用户的订单信息
export const getOrderList = (dataType) => {
  return request.get('/order/list', {
    params: {
      dataType,
      page: 1
    }
  })
}

// 支付订单
export const payOrder = (orderId) => {
  return request.get('/order/pay', {
    params: {
      orderId,
      payType: 10
    }
  })
}

// 取消订单
export const cancelOrder = (orderId) => {
  return request.post('/order/cancel', {
    orderId
  })
}

// 订单确认收获
export const receiptOrder = (orderId) => {
  return request.post('/order/receipt', {
    orderId
  })
}
